Ext.BLANK_IMAGE_URL = '../ext/resources/images/default/s.gif';
Ext.ux.AdminList = Ext.extend(Ext.Panel, {
	border:false,
	layout : 'border',
	closable : 'true',
	title:'管理员列表',
	initComponent : function() {
		var basePath = document.getElementById("basePath").href;
		var adminListUrl = basePath + 'admin/list.action?visible=true';
		var limit = 20;
	
		var adminStore = new Ext.data.Store({
			proxy:new Ext.data.HttpProxy({url: adminListUrl}),
		    reader : new Ext.data.JsonReader({
			    idProperty: 'id',       
			    root: 'adminList',
			    totalProperty: 'adminTotal',
			    remoteSort: true,
			    
			    fields: [
			        {name: 'id', mapping:'id', type:'int'},
			        {name: 'username', mapping:'username', type:'string'},
			        {name: 'createDate', mapping:'createDate', type:'string'}
			    ]    
			})
		});
		
		this.items = [{
			xtype : 'grid',
			title : '管理员列表',
			id : 'adminDataGrid',
			region : 'center',
			split : true,
			frame : true,
			loadMask: true,
			autoScroll:true,
			sm: new Ext.grid.RowSelectionModel({singleSelect:true}),
			ds : adminStore,
			columns : [ {
				xtype : 'gridcolumn',
				dataIndex : 'id',
				header : '序号',
				sortable : true,
				width : 40
			}, {
				xtype : 'gridcolumn',
				dataIndex : 'username',
				header : '用户名',
				sortable : true,
				width : 160,
				align : 'left'
			}, {
				xtype : 'gridcolumn',
				dataIndex : 'createDate',
				header : '添加日期',
				sortable : true,
				width : 140
			}],
			bbar: new Ext.PagingToolbar({
	            pageSize: limit,
	            store: adminStore,
	            beforePageText:"当前第",   
	            afterPageText:"页，共 {0} 页",   
	            lastText:"尾页",   
	            nextText :"下一页",   
	            prevText :"上一页",   
	            firstText :"首页",   
	            refreshText:"刷新页面",   
	            displayInfo: true,
	            displayMsg: '显示第 {0} 条到 {1} 条记录，共 {2} 条',
	            emptyMsg: "没有记录"
	        })
		} ];
		Ext.ux.AdminList.superclass.initComponent.call(this);
		adminStore.load({params:{start:0, limit:limit}});
	}
});
Ext.reg('lgnAdminList', Ext.ux.AdminList);
